<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {
    public function index(){
        session('entrance', 0);
        if(isset($_SESSION['loginUser'])){
            $this->display('Fetcher/search');
        }else{
            $this->display('Fetcher/index');
        }
    }

    public function getUserState() {
        if(isset($_SESSION['loginUser'])) {
            $this->success('', $_SESSION['loginUser']);
        } else {
            $this->error();
        }
    }

    public function getEntrance() {
        if(isset($_SESSION['entrance'])) {
            $this->success('', $_SESSION['entrance']);
        } else {
            $this->error();
        }
    }

    public function test(){
        $this->display();
    }
}